/*
 * tabelador.c
 *
 *  Created on: 27/01/2013
 *      Author: marcio
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>


int main(int arg, char* argvs[]){
	char* fileout = argvs[1];
	char* filein = argvs[2];
	char nameg[100];
	int n;
	int m;
	long i, mm, pf;
	float t, tm, tmax, tmin, tdv;
	long nodes, sol;
	FILE* res = fopen(fileout, "w");
	FILE* init = fopen(filein, "r");
	while(!feof(init)){
		tmax = 0;
		tmin = DBL_MAX;
		for(i = 0; i < 10 && !feof(init); i++ ){
			fscanf(init, "%s", nameg);
			printf("%s ", nameg);
			fscanf(init, "%d", &n);
			printf("%d ", n);
			fscanf(init, "%d", &m);
			printf("%d ", m);
			fscanf(init, "%d", &sol);
			printf("%d ", sol);
			fscanf(init, "%f", &t);
			printf("%f ", t);
			fscanf(init, "%lu", &nodes);
			printf("%lu ", nodes);
			fscanf(init, "%lu", &pf);
			printf("%lu ", pf);
			fscanf(init, "%lu", &mm);
			printf("%lu \n", mm);
			tm += t/10.0;
			tmax = t > tmax ? t : tmax;
			tmin = t < tmin ? t : tmin;
			printf("%d \n", i);
		}
		fprintf(res,"%s \t %d \t %d \t %f \t %f \t %f \t %lu \t %lu \t %lu \n", nameg, n, m, sol, nodes, tmin, tmax, tm, pf, mm);
	}
	fclose(res);
	fclose(init);
	return 0;
}
